package com.zhang.apipassenger.controller;

import com.zhang.apipassenger.service.UserService;
import com.zhang.internalcommon.dto.ResponseResult;
import org.checkerframework.checker.units.qual.A;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.servlet.http.HttpServletRequest;

@RestController
public class UserController {

	@Autowired
	private UserService userService;

	@GetMapping("/user")
	public ResponseResult getUsers(HttpServletRequest request) {
		// 	从请求中获取accessToken
		String authorization = request.getHeader("Authorization");
		// 	根据accessToken进行查询
		return userService.getUserByAccessToken(authorization);
	}
}
